package com.eliota.mapper;

import com.eliota.controller.dto.DeviceDto;
import com.eliota.entity.Device;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author MG
 * @since 2023-04-01
 */
@Mapper
public interface DeviceMapper extends BaseMapper<Device> {


    /**
     * 设备借出状态变更
     * @param id
     */
    @Update("update device  set device.del_flag = 1 where id = #{id}")
    void updateStatus(Integer id);



    List<DeviceDto> selectDevicePage(Map<String, Object> params);


    /**
     * 设置设备为以借阅状态
     */

    @Update("update device set device.b_status = 1 where device.id = #{deviceId}")
    void upBStatus(Integer deviceId);

    @Update("update device set device.b_status = 0 where device.id = #{deviceId}")
    void downBStatus(Integer deviceId);



}
